package com.kuang.config;


import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.View;
import org.springframework.web.servlet.ViewResolver;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import java.util.Locale;
//如果你想  diy  一些定制化的功能 , 只需要写这个组件 , 然后将他交给springboot  springboot就会自动装配
//扩展Spring  DispatcherServlet
@Configuration  //让这个类变成一个配置类
public class MyMvcConfig  implements WebMvcConfigurer {

    //public interface ViewResolver {  实现了视图解析器接口的类 , 我们就可以把他看做视图解析器

    @Bean//把这个bean放到了这个spring容器里面
    public ViewResolver myViewResolver(){
        return  new MyViewResolver();
    }

    //自定义了一个自己的视图解析器MyViewResolver
    public static class MyViewResolver implements ViewResolver{
        @Override
        public View resolveViewName(String viewName, Locale locale) throws Exception {
            return null;
        }
    }

}


